import {BasicColumn, FormSchema} from '/@/components/Table';
import {payWayList} from "./api";

export const columns: BasicColumn[] = [
  {
    title: '会员姓名',
    dataIndex: 'userName',
    width: 120,
  },
  {
    title: '手机号',
    dataIndex: 'mobile',
    width: 120,
  },
  {
    title: '紧急手机号',
    dataIndex: 'telephone',
    width: 120,
  },
  {
    title: '证件类型',
    dataIndex: 'identityType',
    width: 120,
  },
  {
    title: '卡种名称',
    dataIndex: 'goodsName',
    width: 120,
  },
  {
    title: '会员卡号',
    dataIndex: 'vipCardNo',
    width: 120,
  },
  {
    title: '卡状态',
    dataIndex: 'vipCardState',
    width: 120,
  },
  {
    title: '销售姓名',
    dataIndex: 'refundSourceType',
    width: 120,
  },
  {
    title: '合卡销售',
    dataIndex: 'heKaRemark',
    width: 120,
  },
  {
    title: '开卡地',
    dataIndex: 'airportName',
    width: 120,
  },
  {
    title: '开卡日期',
    dataIndex: 'buyDate',
    width: 120,
  },
  {
    title: '来源',
    dataIndex: 'sourceType',
    width: 120,
  },
  {
    title: '收款方式',
    dataIndex: 'paywayName',
    width: 120,
  },
  {
    title: '支付金额',
    dataIndex: 'payAmount',
    width: 120,
  },
  {
    title: '贵宾厅服务有效期',
    dataIndex: 'viproomDate',
    width: 120,
  },
  {
    title: '贵宾厅服务状态',
    dataIndex: 'vipServerIsExpre',
    width: 120,
  },
  {
    title: '是否升级卡种',
    dataIndex: 'isUpgrade',
    width: 120,
  },
  {
    title: '标签',
    dataIndex: 'newestTagRemark',
    width: 120,
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    width: 120,
  },
];

let payType = '';
export const searchFormSchema: FormSchema[] = [
  {
    field: 'userName',
    label: '姓名',
    component: 'Input',
    colProps: {span: 4}
  },
  {
    field: 'mobile',
    label: '手机号',
    component: 'Input',
    colProps: {span: 4}
  },
  {
    field: 'vipCardNo',
    label: '卡号',
    component: 'Input',
    colProps: {span: 4}
  },
  {
    field: 'employeeName',
    label: '销售/合作商',
    component: 'Input',
    colProps: {span: 4}
  },
  {
    field: 'payType',
    label: '收款方式',
    component: 'Select',
    colProps: {span: 4},
    componentProps: ({formActionType}) => {

      return {
        options: [
          {label: '全部', value: ''},
          {label: '讯联微信', value: 'PAY_WX'},
          {label: '银联微信', value: 'PAY_WX_YINLIAN'},
          {label: '线下支付', value: 'PAY_UNDERLINE'},
        ],
        onChange: (payType) => {
          console.info('payType', payType)
          const {updateSchema} = formActionType;
          //所属部门修改后更新负责部门下拉框数据
          updateSchema([{
            field: 'payparamId',
            componentProps: {params: {payType}},
          }]);
        }
      }
    },
  },
  {
    field: 'payparamId',
    label: '支付通道',
    component: 'ApiSelect',
    colProps: {span: 4},
    required: false,
    componentProps: {
      api: payWayList,
      params: {},
      labelField: 'paywayName',
      valueField: 'paywayId',
      immediate: true,
      showSearch: true,
      onChange: (e) => {
        console.log('selected:', e);
        console.log('selected1:', payType);
      }
    },
  },
  {
    field: 'payInfoId',
    label: '支付Id',
    component: 'Input',
    colProps: {span: 4}
  },
  {
    field: 'goodsId',
    label: '卡种',
    component: 'Input',
    colProps: {span: 4}
  },
  {
    field: 'airportId',
    label: '开卡地',
    component: 'Input',
    colProps: {span: 4}
  },
  {
    field: 'vipCardState',
    label: '状态',
    component: 'Input',
    colProps: {span: 4}
  },
  {
    field: 'sourceType',
    label: '来源',
    component: 'Input',
    colProps: {span: 4}
  }, {
    field: 'startDate',
    label: '开始日期',
    component: 'DatePicker',
    colProps: {span: 5},
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    }
  },
  {
    field: 'endDate',
    label: '结束日期',
    component: 'DatePicker',
    colProps: {span: 5},
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    }
  }
];
